const user = {
  state:
    window.sessionStorage.getItem("state") != null
      ? JSON.parse(window.sessionStorage.getItem("state"))
      : {
          user: {
            userName: "",
            userPassword: "",
          },
        },
  getters: {
    getUser(state) {
      return state.user;
    },
  },
  mutations: {
    UPDATE_USER(state, user) {
      state.user = user;
    },
  },
  actions: {
    asyncUpdateUser({ commit }, user) {
      commit("UPDATE_USER", user);
    },
  },
};

export default user;
